Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the testing period for aggregated consumption #5601

Merged

Conversation

mbayopanda
Copy link
Collaborator

This PR fixes issue #5600

Close #5600

@mbayopanda mbayopanda requested review from lomamech and jniles April 30, 2021 14:49
@jniles
Copy link
Collaborator

jniles commented May 2, 2021

Ran the tests. This fixes it. It was probably Feb with 28 days that threw us off...

bors r+

bors bot added a commit that referenced this pull request May 2, 2021
5601: Fix the testing period for aggregated consumption r=jniles a=mbayopanda

This PR fixes issue #5600 

Close #5600 

Co-authored-by: mbayopanda <mbayopanda@gmail.com>
@bors
Copy link
Contributor

bors bot commented May 2, 2021

Build failed:

@jniles
Copy link
Collaborator

jniles commented May 2, 2021

bors try

bors bot added a commit that referenced this pull request May 2, 2021
@bors
Copy link
Contributor

bors bot commented May 2, 2021

try

Build failed:

@jmcameron
Copy link
Collaborator

I tried running the tests on my laptop. The integration tests passed, but I see a failure in the Stock integration test:

image

The end-to-end tests passed. So the only test that failed is the "Stock Integration" test.

@jmcameron
Copy link
Collaborator

jmcameron commented May 4, 2021

I tried running the tests on my laptop. The integration tests passed, but I see a failure in the Stock integration test

I wonder if this is because April only has 30 days?

When I look at the failure, I see (in depot.js:106) that the expected values are:
values = {
algo_def : 33.27,
algo_msh : 33.15,
sum_days : 365,
sum_stock_day : 275,
sum_consumption_day : 8,
sum_consumed_quantity : 300,
number_of_month : 12,
sum_stock_out_days : 90,
head_days : 0,
};
But the actual values (from res.body) are:
algo_def : 33.15,
algo_msh : 33.93,
sum_days : 365,
sum_stock_day : 276,
sum_consumption_day : 8,
sum_consumed_quantity : 300,
number_of_month : 12,
sum_stock_out_days : 89,
head_days : 0,

When I checked the CMM calculations they are correct based on the difference in the value of 'sum_stock_out_days'. So I think this is the key to the problem.

@jmcameron
Copy link
Collaborator

I was able to git this test working by converting the calculations of expiration dates based on DAY's (not MONTH's) in the stock SQL and updating the depot test file. I modified these files (renamed, attached)
modified: test/data/service-stock.sql
modified: test/integration-stock/depots.js
service-stock.sql.txt
depots.js.txt

@jniles and @mbayopanda : Please try these files and see if they work on your system. If so, this seems like the correct approach since it guarantees the same number of days for the tests/expirations/etc regardless of whether months have different numbers of days. However I think I may something may need further fixing because the "head_days" changed from 0 to 29 for the tests.

@mbayopanda
Copy link
Collaborator Author

mbayopanda commented May 5, 2021

I tried running the tests on my laptop. The integration tests passed, but I see a failure in the Stock integration test:

image

The end-to-end tests passed. So the only test that failed is the "Stock Integration" test.

@jmcameron what is your environment configuration (MySQL version, Node version, OS) because the integration tests passed on my configuration (MySQL 5.7 and 8, Node 16.0.0, Windows 10.

You're right Sir, the Stock Integration Tests failed on both MySQL 5.7 and 8, the good news is that the updates you made fix the tests. Thank you 👍🏽

@mbayopanda
Copy link
Collaborator Author

I was able to git this test working by converting the calculations of expiration dates based on DAY's (not MONTH's) in the stock SQL and updating the depot test file. I modified these files (renamed, attached)
modified: test/data/service-stock.sql
modified: test/integration-stock/depots.js
service-stock.sql.txt
depots.js.txt

@jniles and @mbayopanda : Please try these files and see if they work on your system. If so, this seems like the correct approach since it guarantees the same number of days for the tests/expirations/etc regardless of whether months have different numbers of days. However I think I may something may need further fixing because the "head_days" changed from 0 to 29 for the tests.

The tests works correctly now on my machine 👍🏽

Copy link
Collaborator

@jniles jniles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Great fix @jmcameron

bors r+

@bors
Copy link
Contributor

bors bot commented May 5, 2021

Build succeeded:

@bors bors bot merged commit a467722 into Third-Culture-Software:master May 5, 2021
@mbayopanda mbayopanda deleted the 5600-fix-e2e-test-fail branch September 13, 2021 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E test broken in master
3 participants